We have arranged both charts for 1 and 2 just because the explanation for both the queries becomes easy.
As we can see that the number of terrorist attack are growing as the timeline goes forward.
A probable cause would be the advancement in technology and the development of new materials i.e. advancement in chemical warfare etc.
Second can be the advancement in media i.e. due to advancement in media.
Third can be political reasons. Example can be given of the Naxalites terror in the northern regions in India.
Socioeconomic causes like poverty is also influencing the terrorism to great extent.People with strong economic background are being targeted by the groups of people with lower economic background to acquire there wealth and technology.
Apart from these we can see that every terror attack Constitutes of bombings rather than any other means of terror attack like mass executions by gunning people, This is just because bombs are an efficient way to terrorise more people or rather a mass population.
Also, the bombs are nowadays more advanced and easily concealable, like the chemical bombs which can be easily made from normal chemicals.And there are nail bombs which can be mad from only a pressure cooker can you imagine.
So, these were some probable causes for the increase in terror attacks and the increase in use of bombings as a terror device.
q1_td=terrorist_data%>%group_by(iyear)%>%summarise(No_of_Terrorist_attacks=n())
q1_ggplot=ggplot(q1_td,aes(x=iyear,y=No_of_Terrorist_attacks))+
geom_area(fill="light blue")+
geom_point(col="black",size=0.9) + labs(subtitle="X-Axis:Year\nY-Axis:Number of terrorist attacks",
y="Number of Terrorist attacks", x="Year", title="Number of Attacks per year",
caption = "Source: Global Terrorism Database")
ggplotly(q1_ggplot)
q2_td=terrorist_data%>%
filter(attacktype1_txt=="Bombing/Explosion")%>%
group_by(iyear)%>%
summarise(no_of_terrorist_bombings=n())
## Warning: package 'bindrcpp' was built under R version 3.4.4
q2_ggplot=ggplot(q2_td,aes(x=iyear,y=no_of_terrorist_bombings))+
geom_area(fill="light green")+
geom_point(size=0.9) + labs(subtitle="X-Axis:Year\nY-Axis:Number of terrorist bombings",
y="Number of Terrorist Bombings", x="Year", title="Number of Bombings per year",
caption = "Source: Global Terrorism Database")
ggplotly(q2_ggplot)
grid.arrange(q1_ggplot,q2_ggplot)
As we can see there is variation of attacks respective to the following regions defined.
Regions like South Asia which have a higher rate of increase in terror attack also tells us that it has larger surface area prone to terror attack and also a large population to be terrorised.
While countries like South Asia and Africa have an increased rate of terror attacks, We see that regions like North and South America are very well doing in combating terrorism and have a decreasing rate of terrorist attack
q3_td=terrorist_data%>%group_by(region_txt,iyear)%>%summarise(No_of_attacks_each_year=n())
q3_ggplot=ggplot(q3_td,aes(x=iyear,y=No_of_attacks_each_year))+
geom_area(aes(fill = as.factor(region_txt)))+
theme_bw() + facet_wrap(~region_txt, scales="free_y",ncol=3)+
geom_point(col="black",size=0.9)+
theme(legend.position="none")+
theme(panel.spacing = unit(2, "lines")) + labs(subtitle="X-Axis:Year\nY-Axis:Number of attacks each year",
y="Number of attacks each year", x="Year", title="Terrorist attacks region wise per year",
caption = "Source: Global Terrorism Database", fill = "Region")
ggplotly(q3_ggplot)
It is clear by seeing the plotting that bombing and explosions are being mainly used as a terror method in every region either small or large. The probable cause can be advancement in the bomb making technology and the amount of destruction caused by it.
Second most prevalent attack type is clearly armed assaults because of easy availability of arms in the following regions. It might be the cause of a weak arms act or the smuggling of arms to different regions.
Facility and infrastructure attacks with Assassinations can become the third most prevalent attack types. Probable causes are assassinations of political leaders in a high scale might be to overthrow government. Also the infrastructures are targeted so that high amount of property damage is done
q4_td=terrorist_data%>%group_by(region_txt,attacktype1_txt)%>%
summarise(No_of_attacks=n())%>%
top_n(5)
## Selecting by No_of_attacks
q4_ggplot=ggplot(q4_td,aes(x=attacktype1_txt,y=No_of_attacks))+
geom_bar(stat = "Identity",width = .5, aes(fill = as.factor(attacktype1_txt)))+
theme_bw() + facet_wrap(~region_txt, scales="free",ncol=3)+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())+
theme(panel.spacing = unit(1, "lines"))
q4_ggplot = q4_ggplot + labs(subtitle="X-Axis:Year\nY-Axis:Number of attacks",
y="Number of attacks", x="Attack Type",
title="Top 5 type of terror attacks per region",
caption = "Source: Global Terrorism Database", fill="Attack Type")
q4_ggplot
##Question-5
Inferring from the graph Wounds and killed in Police are high as they are first responders to any terrorist attacks and they are responsible for law and order at the ground level so this make them in direct line of attack from terrorists
Similarly Government Military forces work mostly in warzones resulting in higher casualties
q5_td=terrorist_data%>%
group_by(targtype1_txt)%>%summarise(maximum_kills=sum(nkill,na.rm = TRUE),maximum_wounded=sum(nwound,na.rm = TRUE))
q5_ggplot=q5_td%>%gather(-targtype1_txt,key="var",value="value")%>%
ggplot(aes(x=targtype1_txt,y=value))+
geom_bar(stat = "Identity",aes(fill=as.factor(targtype1_txt))) +
facet_wrap(~ var, scales = "free") +
theme_bw()+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())+
theme(panel.spacing = unit(3, "lines"))
q5_ggplot = q5_ggplot + labs(subtitle="X-Axis:Target Type\nY-Axis:Number of attacks",
y="Number of attacks", x="Target Type", title="Heaviest hit target types (Based on both Killed and wounded)",
caption = "Source: Global Terrorism Database", fill = "Target Type")
ggplotly(q5_ggplot)
## Question-6
Total number of terrorist attack over 45 years in Pakistan and India are approximately equal
Till 2006, average number of total terrorist attacks in India is higher than that of Pakistan, After 2006, total number of attacks and number of casualties have increased drastically in Pakistan and significantly higher than India
We can contribute to higher attacks in India Pre 2006 mainly due to combination of Naxal related attacks, NE insurgency, Kashmir attacks and other internal problems
After 2006, there is multi-fold increase in number of attacks in Pakistan which is mainly attributed to blow back from ‘War on Terror’ in Afghanistan and Pakistan
q6_td=terrorist_data%>%filter(iyear!=1970)%>%
filter(country_txt=="India" | country_txt=="Pakistan")%>%
group_by(iyear,country_txt)%>%summarise(No_of_Attacks=n())
q6_ggplot=ggplot(q6_td,aes(x=iyear,y=No_of_Attacks))+
geom_area(aes(fill=as.factor(country_txt)))+geom_point()+
theme_bw() + facet_wrap(~country_txt,scales = "free")+
theme(panel.spacing = unit(3, "lines"))+
theme(axis.title.x = element_blank(),axis.title.y = element_blank())
q6_ggplot = q6_ggplot + labs(subtitle="X-Axis:Year\nY-Axis:Number of attacks",
title="Terrorist attack in India and Pakistan in last 45 years",
caption = "Source: Global Terrorism Database", fill = "Country")
ggplotly(q6_ggplot)
After the breaking of USSR among smaller countries the number of terror attacks in the region increased significantly. United States faced worst attacks till 9/11 and after that the intensity and number of attacks fell down drastically which resulted in influx of terror attack in many other regions of Russian Federation
q7_td=terrorist_data%>%filter(iyear!=1970)%>%
filter(country_txt=="Russia" | country_txt=="United States")%>%
group_by(iyear,country_txt)%>%
summarise(No_of_Attacks=n())
q7_ggplot=ggplot(q7_td,aes(x=iyear,y=No_of_Attacks))+
geom_area(stat = "Identity",width = .5,aes(fill=as.factor(country_txt)))+
theme_bw() + facet_wrap(~country_txt,scales = "free")+geom_point()
## Warning: Ignoring unknown parameters: width
q7_ggplot = q7_ggplot + labs(subtitle="X-Axis:Year\nY-Axis:Number of attacks",
y="Number of attacks", x="Year", title="Terror attack in United States vs Russian Federation/USSR in last 45 years",
caption = "Source: Global Terrorism Database", fill = "Country")
q7_ggplot
##Question-7 graph 2
q7_ggplot2=ggplot(q7_td,aes(x=iyear,y=No_of_Attacks))+
geom_bar(stat = "Identity",width = .5,aes(fill=as.factor(country_txt)))+
theme_bw()
q7_ggplot2
2)It is due to the continued failed effort of United Nations to stop these from making the region unstable and war-torn. In other regions namely - Afghanistan and Pakistan this is the one of the reason
q8_select=terrorist_data%>%select(country_txt,nkill)
q8_td=q8_select%>%filter(!is.na(country_txt),country_txt!=".")%>%
group_by(country_txt)%>%summarise(maximum_kills=sum(nkill,na.rm = TRUE))%>%
arrange(-maximum_kills)%>%
head(10)
q8_ggplot=ggplot(q8_td,aes(x=country_txt,y=maximum_kills))+
geom_bar(stat="Identity",width=0.5,aes(fill=as.factor(country_txt)))+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
q8_ggplot = q8_ggplot + labs(subtitle="X-Axis:Countries\nY-Axis:No. of Casualties",
y=":No. of Casualties", x="Countries", title="Where are more Casualties",
caption = "Source: Global Terrorism Database", fill = "Country")
q8_ggplot
##Question-9 Causalities throughout the year had evolved region wise. Since the beginning of 21st century it had become more of concentrated in the region of Libya, Syria, Iraq, Pakistan, and Afghanistan. The count of casualties evolved region wise and year wise in a hierarchical order.
q9_td=terrorist_data%>%group_by(iyear) %>%
summarise(total.casualties = sum(nkill+nwound, na.rm = TRUE))
View(q9_td)
q9_ggplot=ggplot(q9_td,aes(x=iyear,y=total.casualties))+
geom_area(fill = "#cc99ff")+ geom_point()
labs(subtitle="X-Axis:Year\nY-Axis:Total casualties",
y="Total casualties", x="Year", title="Total casualties over the years",
caption = "Source: Global Terrorism Database")
## $subtitle
## [1] "X-Axis:Year\nY-Axis:Total casualties"
##
## $y
## [1] "Total casualties"
##
## $x
## [1] "Year"
##
## $title
## [1] "Total casualties over the years"
##
## $caption
## [1] "Source: Global Terrorism Database"
##
## attr(,"class")
## [1] "labels"
ggplotly(q9_ggplot)
q10_select=terrorist_data%>%select(iyear,weaptype1_txt,nkill)
q10_td=q10_select%>%
group_by(weaptype1_txt)%>%
summarise(Total_Kills=sum(nkill,na.rm = TRUE))%>%
arrange(-Total_Kills)
q10_head6=q10_td%>%head(6)
q10_tail6=q10_td%>%tail(6)
a10=ggplot(q10_head6,aes(x=weaptype1_txt,y=Total_Kills))+
geom_bar(stat="identity",aes(fill=as.factor(weaptype1_txt)))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())+
theme(legend.position="bottom")
b10=ggplot(q10_tail6,aes(x=weaptype1_txt,y=Total_Kills))+
geom_bar(stat="identity",aes(fill=as.factor(weaptype1_txt)))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())+
theme(legend.position="bottom")
grid.arrange(a10,b10)
##Question-11 1. We can see that the top 10 targeted nationalities are same as the top 10 countries where terrorist attacks happen. 2. We can refer from the chart that the residents of the country where the terrorist attacks happen are the most affected nationalities.
q11_select=terrorist_data%>%select(iyear,natlty1_txt,nkill)
q11_td=q11_select%>%
group_by(natlty1_txt)%>%
summarise(Total_Kills=sum(nkill,na.rm = TRUE))%>%
arrange(-Total_Kills)%>%head(10)
q11=ggplot(q11_td,aes(x=natlty1_txt,y=Total_Kills))+
geom_bar(stat="identity",aes(fill=as.factor(natlty1_txt)))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())
ggplotly(q11)
q12_basic=terrorist_data%>%
group_by(country_txt)%>%
filter(doubtterr==0)%>%
summarise(safest_countries=sum(nkill==0,na.rm = TRUE))%>%
arrange(-safest_countries)%>%head(15)
q12_basic_ggplot=ggplot(q12_basic,aes(x=country_txt,y=safest_countries))+
geom_bar(stat = "Identity",width = .9, aes(fill = as.factor(country_txt)))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())
ggplotly(q12_basic_ggplot)
##question 12 plot 2
q12=terrorist_data%>%
group_by(attacktype1_txt,country_txt)%>%
filter(doubtterr==0)%>%
summarise(safest_countries=sum(nkill==0,na.rm = TRUE))%>%
top_n(5)
## Selecting by safest_countries
q12_ggplot=ggplot(q12,aes(x=country_txt,y=safest_countries))+
geom_bar(stat = "Identity",width = .5, aes(fill = as.factor(country_txt)))+
theme_bw() + facet_wrap(~attacktype1_txt, scales="free",ncol=3)+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())+
theme(panel.spacing = unit(3, "lines"))
ggplotly(q12_ggplot)